using KnowledgeQA.Models.Entities;

namespace KnowledgeQA.Core.Interfaces
{
    /// <summary>
    /// 文档处理器接口
    /// </summary>
    public interface IDocumentProcessor
    {
        /// <summary>
        /// 支持的文件类型
        /// </summary>
        IEnumerable<string> SupportedFileTypes { get; }

        /// <summary>
        /// 处理文档
        /// </summary>
        /// <param name="filePath">文件路径</param>
        /// <param name="document">文档实体</param>
        /// <returns>处理结果</returns>
        Task<DocumentProcessResult> ProcessAsync(string filePath, Document document);

        /// <summary>
        /// 检查是否支持该文件类型
        /// </summary>
        /// <param name="fileType">文件类型</param>
        /// <returns>是否支持</returns>
        bool CanProcess(string fileType);
    }

    /// <summary>
    /// 文档处理结果
    /// </summary>
    public class DocumentProcessResult
    {
        /// <summary>
        /// 是否成功
        /// </summary>
        public bool Success { get; set; }

        /// <summary>
        /// 文档内容
        /// </summary>
        public string Content { get; set; } = string.Empty;

        /// <summary>
        /// 文档块列表
        /// </summary>
        public List<DocumentChunk> Chunks { get; set; } = new List<DocumentChunk>();

        /// <summary>
        /// 错误信息
        /// </summary>
        public string? ErrorMessage { get; set; }

        /// <summary>
        /// 处理时间（毫秒）
        /// </summary>
        public long ProcessingTime { get; set; }

        /// <summary>
        /// 元数据
        /// </summary>
        public Dictionary<string, object> Metadata { get; set; } = new Dictionary<string, object>();
    }
} 